package awesome.cpu.structure;

public class RegisterC extends SequentialComponent {

	public final static int KEY_REGC_IN = 1;
	private int mRegCIn;
	
	public final static int KEY_REGC_OUT = 2;
	private int mRegCOut;
	
	private final static RegisterC mInstance = new RegisterC();
	
	private RegisterC() {}
	
	public static RegisterC getInstance() {
		return mInstance;
	}
	
	@Override
	void onClockTick() {
		mRegCOut = mRegCIn;
	}

	@Override
	boolean setData(int keyInterface, int data) {
		switch (keyInterface) {
		case KEY_REGC_IN:
			mRegCIn = data;
			return true;
		}
		return false;
	}

	@Override
	int getData(int keyInterface) {
		switch (keyInterface) {
		case KEY_REGC_OUT:
			return mRegCOut;
		}
		return 0;
	}
}
